<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Class: NotificationSerializer
  
    &mdash; Ruby China API 文档
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  pathId = "NotificationSerializer";
  relpath = '';
</script>


  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <div class="nav_wrap">
      <iframe id="nav" src="class_list.html"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="_index.html">Index (N)</a> &raquo;
    
    
    <span class="title">NotificationSerializer</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <iframe id="search_frame" src="class_list.html"></iframe>

      <div id="content"><h1>Class: NotificationSerializer
  
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName"><span class='object_link'><a href="BaseSerializer.html" title="BaseSerializer (class)">BaseSerializer</a></span></span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ActiveModel::Serializer</li>
          
            <li class="next"><span class='object_link'><a href="BaseSerializer.html" title="BaseSerializer (class)">BaseSerializer</a></span></li>
          
            <li class="next">NotificationSerializer</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  

  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>app/serializers/notification_serializer.rb</dd>
  </dl>
  
</div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>通知</p>

<h2 id="label-attributes">attributes</h2>
<ul><li>
<p><strong>id</strong> [Integer] 编号</p>
</li><li>
<p><strong>type</strong> [String] 通知类型</p>
</li><li>
<p><strong>read</strong> [Boolean] 是否已读</p>
</li><li>
<p><strong>actor</strong> <span class='object_link'><a href="UserSerializer.html" title="UserSerializer (class)">UserSerializer</a></span> 动作发起者</p>
</li><li>
<p><strong>mention_type</strong> [String] 提及的数据类型 Topic, Reply</p>
</li><li>
<p><strong>created_at</strong> [DateTime] 创建时间</p>
</li><li>
<p><strong>updated_at</strong> [DateTime] 更新时间</p>
</li></ul>


  </div>
</div>
<div class="tags">
  

</div>






  
    <h2>
      Instance Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#actor-instance_method" title="#actor (instance method)">#<strong>actor</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#mention-instance_method" title="#mention (instance method)">#<strong>mention</strong>  &#x21d2; TopicSerializer, ReplySerializer </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>通知对应的提及的数据.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#mention_type-instance_method" title="#mention_type (instance method)">#<strong>mention_type</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#node-instance_method" title="#node (instance method)">#<strong>node</strong>  &#x21d2; NodeSerializer </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>通知对应的节点.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#read-instance_method" title="#read (instance method)">#<strong>read</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#reply-instance_method" title="#reply (instance method)">#<strong>reply</strong>  &#x21d2; ReplySerializer </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>通知对应的回帖.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#serializable_object-instance_method" title="#serializable_object (instance method)">#<strong>serializable_object</strong>(options = {})  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#topic-instance_method" title="#topic (instance method)">#<strong>topic</strong>  &#x21d2; TopicSerializer </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>通知对应的话题.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#type-instance_method" title="#type (instance method)">#<strong>type</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods inherited from <span class='object_link'><a href="BaseSerializer.html" title="BaseSerializer (class)">BaseSerializer</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="BaseSerializer.html#abilities-instance_method" title="BaseSerializer#abilities (method)">#abilities</a></span></p>

  

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="actor-instance_method">
  
    #<strong>actor</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


30
31
32</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/serializers/notification_serializer.rb', line 30</span>

<span class='kw'>def</span> <span class='id identifier rubyid_actor'>actor</span>
  <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_actor'>actor</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="mention-instance_method">
  
    #<strong>mention</strong>  &#x21d2; <tt><span class='object_link'><a href="TopicSerializer.html" title="TopicSerializer (class)">TopicSerializer</a></span></tt>, <tt><span class='object_link'><a href="ReplySerializer.html" title="ReplySerializer (class)">ReplySerializer</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>通知对应的提及的数据</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="TopicSerializer.html" title="TopicSerializer (class)">TopicSerializer</a></span></tt>, <tt><span class='object_link'><a href="ReplySerializer.html" title="ReplySerializer (class)">ReplySerializer</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


42
43
44
45</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/serializers/notification_serializer.rb', line 42</span>

<span class='kw'>def</span> <span class='id identifier rubyid_mention'>mention</span>
  <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_notify_type'>notify_type</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>mention</span><span class='tstring_end'>&#39;</span></span>
  <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_target'>target</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="mention_type-instance_method">
  
    #<strong>mention_type</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


34
35
36
37</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/serializers/notification_serializer.rb', line 34</span>

<span class='kw'>def</span> <span class='id identifier rubyid_mention_type'>mention_type</span>
  <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_notify_type'>notify_type</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>mention</span><span class='tstring_end'>&#39;</span></span>
  <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_target_type'>target_type</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="node-instance_method">
  
    #<strong>node</strong>  &#x21d2; <tt><span class='object_link'><a href="NodeSerializer.html" title="NodeSerializer (class)">NodeSerializer</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>通知对应的节点</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="NodeSerializer.html" title="NodeSerializer (class)">NodeSerializer</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


76
77
78
79
80</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/serializers/notification_serializer.rb', line 76</span>

<span class='kw'>def</span> <span class='id identifier rubyid_node'>node</span>
  <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_notify_type'>notify_type</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>node_changed</span><span class='tstring_end'>&#39;</span></span>
  <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_try'>try</span><span class='lparen'>(</span><span class='symbol'>:second_target</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
  <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_second_target'>second_target</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="read-instance_method">
  
    #<strong>read</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


25
26
27</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/serializers/notification_serializer.rb', line 25</span>

<span class='kw'>def</span> <span class='id identifier rubyid_read'>read</span>
  <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_read?'>read?</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="reply-instance_method">
  
    #<strong>reply</strong>  &#x21d2; <tt><span class='object_link'><a href="ReplySerializer.html" title="ReplySerializer (class)">ReplySerializer</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>通知对应的回帖</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="ReplySerializer.html" title="ReplySerializer (class)">ReplySerializer</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


68
69
70
71</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/serializers/notification_serializer.rb', line 68</span>

<span class='kw'>def</span> <span class='id identifier rubyid_reply'>reply</span>
  <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_notify_type'>notify_type</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>topic_reply</span><span class='tstring_end'>&#39;</span></span>
  <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_try'>try</span><span class='lparen'>(</span><span class='symbol'>:target</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="serializable_object-instance_method">
  
    #<strong>serializable_object</strong>(options = {})  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


15
16
17
18
19</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/serializers/notification_serializer.rb', line 15</span>

<span class='kw'>def</span> <span class='id identifier rubyid_serializable_object'>serializable_object</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_cache'>cache</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>v1.4</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>do</span>
    <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="topic-instance_method">
  
    #<strong>topic</strong>  &#x21d2; <tt><span class='object_link'><a href="TopicSerializer.html" title="TopicSerializer (class)">TopicSerializer</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>通知对应的话题</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="TopicSerializer.html" title="TopicSerializer (class)">TopicSerializer</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


51
52
53
54
55
56
57
58
59
60
61
62
63</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/serializers/notification_serializer.rb', line 51</span>

<span class='kw'>def</span> <span class='id identifier rubyid_topic'>topic</span>
  <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_notify_type'>notify_type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>topic</span><span class='tstring_end'>&#39;</span></span> <span class='op'>||</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_notify_type'>notify_type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>node_changed</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_try'>try</span><span class='lparen'>(</span><span class='symbol'>:target</span><span class='rparen'>)</span>
  <span class='kw'>elsif</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_notify_type'>notify_type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>topic_reply</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_try'>try</span><span class='lparen'>(</span><span class='symbol'>:second_target</span><span class='rparen'>)</span>
  <span class='kw'>elsif</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_notify_type'>notify_type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>mention</span><span class='tstring_end'>&#39;</span></span>
    <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_target_type'>target_type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Topic</span><span class='tstring_end'>&#39;</span></span>
      <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_try'>try</span><span class='lparen'>(</span><span class='symbol'>:target</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_target_type'>target_type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Reply</span><span class='tstring_end'>&#39;</span></span>
      <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_try'>try</span><span class='lparen'>(</span><span class='symbol'>:second_target</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="type-instance_method">
  
    #<strong>type</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


21
22
23</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/serializers/notification_serializer.rb', line 21</span>

<span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
  <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_notify_type'>notify_type</span><span class='period'>.</span><span class='id identifier rubyid_classify'>classify</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Thu Oct 20 19:35:17 2016 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.9.5 (ruby-2.3.1).
</div>

    </div>
  </body>
</html>